package LeetCode.leetcode242;

import java.util.HashMap;
import java.util.function.BiFunction;

public class Review1 {
    public boolean isAnagram(String s, String t) {
        int[] map = new int[26];
        if (s.length() != t.length()) return false;
        Character cur;
        for (int i = 0; i < s.length(); i++) {
            cur = s.charAt(i);
            int index = cur - 'a';
            map[index]++;
        }

        for (int i = 0; i < t.length(); i++) {
            cur = t.charAt(i);
            map[cur - 'a']--;
            if (map[cur-'a'] < 0) return false;
        }
        return true;
    }
}
